package homework.day03;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test4 {
    public static void main(String[] args) throws FileNotFoundException {
    	//字符输出流
        FileOutputStream fos = new FileOutputStream("pw.txt");
		OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
		BufferedWriter bw = new BufferedWriter(osw);
		PrintWriter pw = new PrintWriter(bw,true);
		//创建扫描仪
		Scanner scanner = new Scanner(System.in);
		//打桩
		System.out.println("请开始输入内容");
		//死循环
		while(true) {
			//扫描控制台输入的字符
			String str = scanner.nextLine();
			//输入exit后结束程序
			if("exit".equals(str)) {
				break;
			}
			//输出控制台输入的内容
			pw.println(str);
			//关闭字符流
			pw.close();
		}
    }
}
